package com.qfedu.controller;/*
 * @Author: {{author}}
 * @Date:   {{create_time}}
 * @Last Modified by:   {{last_modified_by}}
 * @Last Modified time: {{last_modified_time}}
 */

import com.qfedu.pojo.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.List;

@Api(value = "用户模块接口",tags = "user用户模块")
@RestController
@RequestMapping("user")
public class UserController {

    @ApiOperation(value = "查询员工", notes = "根据ID查询员工", response = User.class)
    @GetMapping("/{id}")
    public User getUser(@PathVariable int id){
        System.out.println("jinrule ");
        return new User(id,"aaa","bbb","ccc",18,"aa@qq.com");
    }
    @GetMapping("/list")
    public List<User> list(){
        User user1 = new User(1,"aaa","bbb","ccc",18,"aa@qq.com");
        User user2 = new User(2,"aaa","bbb","ccc",18,"aa@qq.com");
        User user3 = new User(3,"aaa","bbb","ccc",18,"aa@qq.com");
        return Arrays.asList(user1, user2, user3);
    }

    @GetMapping("/name")
    @ApiOperation(value = "查询员工", notes = "根据名称查询员工", response = User.class)
    @ApiImplicitParam(name = "userName", value="员工姓名", required=true, dataType = "string", dataTypeClass=String.class, example="张三")
    public User findByUserName(String userName){
        return new User(4,"张三","bbb","ccc",18,"aa@qq.com");
    }
}